package com.hjm.project.team.teamYlInfo.service.impl;

import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.hjm.common.exception.BusinessException;
import com.hjm.common.utils.DateUtils;
import com.hjm.common.utils.StringUtils;
import com.hjm.common.utils.security.ShiroUtils;
import com.hjm.framework.shiro.service.PasswordService;
import com.hjm.project.accounts.accounts.domain.Accounts;
import com.hjm.project.accounts.accounts.mapper.AccountsMapper;
import com.hjm.project.agentInfo.agentInfo.domain.AgentInfo;
import com.hjm.project.agentInfo.agentInfo.mapper.AgentInfoMapper;
import com.hjm.project.cardBag.domain.CardBag;
import com.hjm.project.cardBag.mapper.CardBagMapper;
import com.hjm.project.system.user.mapper.UserMapper;
import com.hjm.project.team.policy.domain.TeamPolicy;
import com.hjm.project.team.policy.mapper.TeamPolicyMapper;
import com.hjm.project.team.teamYl.domain.TeamYl;
import com.hjm.project.team.teamYl.mapper.TeamYlMapper;
import com.hjm.project.team.teamYlInfo.domain.TeamYlInfoDo;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import com.hjm.project.team.teamYlInfo.mapper.TeamYlInfoMapper;
import com.hjm.project.team.teamYlInfo.domain.TeamYlInfo;
import com.hjm.project.team.teamYlInfo.service.ITeamYlInfoService;
import com.hjm.common.utils.text.Convert;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * 团员信息Service业务层处理
 * 
 * @author maker-platform
 * @date 2021-04-10
 */
@Service
public class TeamYlInfoServiceImpl implements ITeamYlInfoService 
{
    @Resource
    private TeamYlInfoMapper teamYlInfoMapper;     //团员信息
    @Resource
    private TeamYlMapper teamYlMapper;             //团队信息
    @Resource
    private TeamPolicyMapper teamPolicyMapper;  //团政策信息
    @Resource
    private AgentInfoMapper agentInfoMapper;        //代理商信息
    @Resource
    private AccountsMapper accountsMapper;          //结算账户
    @Resource
    private CardBagMapper cardBagMapper;            //卡包表
    @Resource
    private UserMapper userMapper;                  //用户表
    @Resource
    private PasswordService passwordService;        //密码服务(加密修改密码)
    /**
     * 查询团员信息
     * 
     * @param ylId 团员信息ID
     * @return 团员信息
     */
    @Override
    public TeamYlInfoDo selectTeamYlInfoById(String ylId)
    {
        return teamYlInfoMapper.selectTeamYlInfoById(ylId);
    }

    /**
     * 查询全部团长
     *
     * @return 团长信息
     */
    @Override
    public List<TeamYlInfo> selectAllTeamYl(TeamYlInfo teamYlInfo)
    {
        return teamYlInfoMapper.selectAllTeamYl(teamYlInfo);
    }

    /**
     * 查询团员信息列表
     * 
     * @param teamYlInfo 团员信息
     * @return 团员信息
     */
    @Override
    public List<TeamYlInfoDo> selectTeamYlInfoList(TeamYlInfoDo teamYlInfo){
        List<TeamYlInfoDo> teamYlInfoDos = teamYlInfoMapper.selectTeamYlInfoList(teamYlInfo);
        for (TeamYlInfoDo teamYlInfoDo : teamYlInfoDos) {
            //通过引流编号获取引流的政策信息
            if (StringUtils.isNotEmpty(teamYlInfoDo.getPolicyYlId())) {
                StringBuffer ylSb = new StringBuffer();
                String policyYlId = teamYlInfoDo.getPolicyYlId();
                TeamPolicy tp = new TeamPolicy();
                tp.setPolicyId(policyYlId);
                tp.setTeamType(String.valueOf(teamYlInfoDo.getTeamType()));
                tp.setRewardType("6");
                List<TeamPolicy> teamPolicies = teamPolicyMapper.selectTeamPolicyList(tp);
                for (TeamPolicy teamPolicy : teamPolicies) {
                    ylSb.append("[" + teamPolicy.getPolicyName()  + "]").append(",");
                }
                if (StringUtils.isNotEmpty(ylSb)) {
                    teamYlInfoDo.setPolicyYlName(ylSb.toString().substring(0,ylSb.toString().lastIndexOf(",")));
                }
            }

            //通过引流编号获取引流的政策信息
            if (StringUtils.isNotEmpty(teamYlInfoDo.getPolicyCgId())) {
                StringBuffer ylSb = new StringBuffer();
                String policyCgId = teamYlInfoDo.getPolicyCgId();
                TeamPolicy tp = new TeamPolicy();
                tp.setPolicyId(policyCgId);
                tp.setTeamType(String.valueOf(teamYlInfoDo.getTeamType()));
                List<TeamPolicy> teamPolicies = teamPolicyMapper.selectTeamPolicyList(tp);
                for (TeamPolicy teamPolicy : teamPolicies) {
                    ylSb.append("[" + teamPolicy.getPolicyName()  + "]").append(",");
                }
                if (StringUtils.isNotEmpty(ylSb)) {
                    teamYlInfoDo.setPolicyCgName(ylSb.toString().substring(0,ylSb.toString().lastIndexOf(",")));
                }
            }

            //通过引流编号获取引流的政策信息
            if (StringUtils.isNotEmpty(teamYlInfoDo.getPolicyZlId())) {
                StringBuffer zlSb = new StringBuffer();
                String policyZlId = teamYlInfoDo.getPolicyZlId();
                TeamPolicy tp = new TeamPolicy();
                tp.setPolicyId(policyZlId);
                tp.setTeamType(String.valueOf(teamYlInfoDo.getTeamType()));
                List<TeamPolicy> teamPolicies = teamPolicyMapper.selectTeamPolicyList(tp);
                for (TeamPolicy teamPolicy : teamPolicies) {
                    zlSb.append("[" + teamPolicy.getPolicyName()  + "]").append(",");
                }
                if (StringUtils.isNotEmpty(zlSb)) {
                    teamYlInfoDo.setPolicyZlName(zlSb.toString().substring(0,zlSb.toString().lastIndexOf(",")));
                }
            }

            //通过GB传统引流奖励引流的政策信息
            if (StringUtils.isNotEmpty(teamYlInfoDo.getPolicyGbId())) {
                StringBuffer zlSb = new StringBuffer();
                String policyZlId = teamYlInfoDo.getPolicyGbId();
                TeamPolicy tp = new TeamPolicy();
                tp.setPolicyId(policyZlId);
                tp.setTeamType(String.valueOf(teamYlInfoDo.getTeamType()));
                tp.setRewardType("5");
                List<TeamPolicy> teamPolicies = teamPolicyMapper.selectTeamPolicyList(tp);
                for (TeamPolicy teamPolicy : teamPolicies) {
                    zlSb.append("[" + teamPolicy.getPolicyName()  + "]").append(",");
                }
                if (StringUtils.isNotEmpty(zlSb)) {
                    teamYlInfoDo.setPolicyGbName(zlSb.toString().substring(0,zlSb.toString().lastIndexOf(",")));
                }
            }
        }
        return teamYlInfoDos;
    }

    /**
     * 新增团长信息
     * 
     * @param teamYlInfo 团长
     * @return 结果
     */
    @Override
    @Transactional
    public int insertTeamYlInfo(TeamYlInfo teamYlInfo,TeamYl teamYl) {
        if (teamYlInfo.getTeamType() == null) {
            throw new BusinessException("请选择团类型");
        }


        String password = teamYlInfo.getPassword();
        //团长手机号
        String loginName = teamYlInfo.getLoginName();

        AgentInfo ai = new AgentInfo();
        ai.setLinkPhone(loginName);
        List<AgentInfo> agentInfos = agentInfoMapper.selectAgentInfoListAll(ai);
        if (CollectionUtils.isNotEmpty(agentInfos)) {
            throw new BusinessException("当前团长账号已存在");
        }


        //查看当前展业端管理盟主是否是团员
        TeamYlInfoDo ty = new TeamYlInfoDo();
        ty.setAgentNum(teamYl.getLeaderAgentNum());
        ty.setTeamType(teamYlInfo.getTeamType());
        List<TeamYlInfoDo> teamYlInfosDo = teamYlInfoMapper.selectTeamYlInfoList(ty);
        if (CollectionUtils.isNotEmpty(teamYlInfosDo)) {
            TeamYlInfoDo teamYlInfo1 = teamYlInfosDo.get(0);
            if (teamYlInfo1.getYlType().equals("1")) {
                throw new BusinessException("当前展业端管理盟主已是团长不可重复开团");
            }
            if (teamYlInfo1.getYlType().equals("2")) {
                throw new BusinessException("当前展业端管理盟主已是团成员,不可申请开团");
            }
        }
        //获取一个当前团长的展业端管理信息
        AgentInfo agentInfo = agentInfoMapper.selectAgentInfoById(teamYl.getLeaderAgentNum());
        Integer ylIdInfo = teamYlInfoMapper.selectYlId();

        //新增团长信息
        teamYlInfo = new TeamYlInfo();
        teamYlInfo.setYlId(ylIdInfo);
        teamYlInfo.setAgentNum(teamYl.getLeaderAgentNum());
        teamYlInfo.setAgentName(teamYl.getLeaderAgentName());
        teamYlInfo.setStatus("1");
        teamYlInfo.setCreteDate(DateUtils.getDate());
        teamYlInfo.setAddMan(ShiroUtils.getLoginName());
        teamYlInfo.setYlType("1");
        teamYlInfo.setTeamYlId(teamYl.getTeamYlId());
        teamYlInfo.setIsLevel("1");
        teamYlInfo.setYlName(agentInfo.getCommissary()); //法人名称
        teamYlInfo.setParentYlId(ylIdInfo);
        teamYlInfo.setLoginName(loginName);
        teamYlInfo.setPosNum(teamYl.getPosNum());
        teamYlInfo.setTeamType(teamYl.getTeamType());
        teamYlInfo.setPassword(DigestUtils.md5Hex(password));
        int k = teamYlInfoMapper.insertTeamYlInfo(teamYlInfo);
        if (k  <= 0) {
            throw new BusinessException("新增团长失败");
        }
        //通过政策编号ID获取政策唯一编号
        //引流
        //老团不可设置新团政策
        String ylId = teamYl.getPolicyYlId().replace(",", "");
        if (StringUtils.isNotEmpty(ylId)) {
            TeamPolicy yl = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(ylId));
            teamYl.setPolicyYlId(yl.getPolicyId());
        }
        //采购
        String cgId = teamYl.getPolicyCgId().replace(",", "");
        if (StringUtils.isNotEmpty(cgId)) {
            TeamPolicy cg = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(cgId));
            teamYl.setPolicyCgId(cg.getPolicyId());
        }
        //增量
        String zlId = teamYl.getPolicyZlId().replaceAll(",", "");
        if (StringUtils.isNotEmpty(zlId)) {
            TeamPolicy cg = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(zlId));
            teamYl.setPolicyZlId(cg.getPolicyId());
        }
        //GB
        /*String gbId = teamYl.getPolicyGbId().replaceAll(",", "");
        if (StringUtils.isNotEmpty(gbId)) {
            TeamPolicy gb = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(gbId));
            teamYl.setPolicyGbId(gb.getPolicyId());
        }*/
        teamYl.setStatus("1");
        teamYl.setCreateDate(new Date());
        teamYl.setAddMan(ShiroUtils.getLoginName());
        teamYl.setLeaderId(teamYlInfo.getYlId());
        teamYl.setLeaderName(agentInfo.getCommissary());
        teamYl.setTeamNum(1);  //新建团默认团队数是1
        teamYl.setTeamNumHy(1);
        //新增团信息
        int i = teamYlMapper.insertTeamYl(teamYl);
        if (i <= 0) {
            throw new BusinessException("添加团长信息失败");
        }

        //同步一份团长代理信息
        AgentInfo agentInfo1 = agentInfoMapper.selectAgentInfoById(teamYlInfo.getAgentNum());
        agentInfo1.setSaleType("2");
        agentInfo1.setBelongAgent(null);
        agentInfo1.setAgentNum(teamYlInfo.getYlId().toString());
        agentInfo1.setAgentName(agentInfo1.getAgentName() + "-团长");
        agentInfoMapper.insertAgentInfo(agentInfo1);


        //同步团长的展业端管理结算账户到团(复制一份)
        Accounts accounts = new Accounts();
        accounts.setSeqId(teamYlInfo.getAgentNum());
        Accounts act = accountsMapper.selectAccounts(accounts);
        if (act == null) {
            throw  new BusinessException("请先添加团长结算账户");
        }
        //同步为团队账户
        act.setId(null);
        act.setSeqId(teamYlInfo.getYlId().toString());
        int a = accountsMapper.insertAccounts(act);
        if (a <= 0) {
            throw new BusinessException("同步结算卡数据失败");
        }
        //同步卡包表
        CardBag cardBag = new CardBag();
        cardBag.setMerno(teamYlInfo.getAgentNum());
        cardBag = cardBagMapper.selectCardBag(cardBag);
        if (cardBag == null) {
            throw  new BusinessException("卡包没有结算卡数据");
        }
        cardBag.setId(null);
        cardBag.setMerno(teamYlInfo.getYlId().toString());
        int i1 = cardBagMapper.insertCardBag(cardBag);

        //获取一个团长的用户登录信息
       /*   User loginInfo = userMapper.selectUserByPhoneNumber(loginName);
        if (loginInfo != null) {
            throw  new BusinessException("手机号已存在");
        }


        //添加一个用户
      User user = new User();
        user.randomSalt();
        user.setLoginName(loginName);
        user.setPassword(passwordService.encryptPassword(loginName, password, user.getSalt()));
        user.setStatus("0");
        user.setDelFlag("0");
        user.setBelong(Long.parseLong("1"));
        user.setObjNo(teamYlInfo.getYlId().toString());
        user.setCreateTime(DateUtils.getNowDate());
        user.setSex("1");
        user.setPhonenumber(loginName);
        user.setCreateBy(ShiroUtils.getSysUser().getLoginName());
        user.setUserName(loginName);
        user.setDeptId(Long.parseLong("108"));
        userMapper.insertUser(user);*/
        return i1;
    }
    /**
     * 新增团员信息
     *
     * @param teamYlInfo 团员信息
     * @return 结果
     */
    @Override
    @Transactional
    public int addGroup(TeamYlInfo teamYlInfo,TeamYl teamYl) throws ParseException {
        //当前登录人
        String loginName = ShiroUtils.getSysUser().getLoginName();
        //团长编号
        Integer ylId = teamYlInfo.getYlId();
        //团长名称
        String ylName = teamYlInfo.getYlName();
        //团长基本信息
        TeamYlInfoDo tyInfo = new TeamYlInfoDo();
        tyInfo.setYlId(ylId);
        tyInfo.setStatus("1");
        List<TeamYlInfoDo> tyInfoList = teamYlInfoMapper.selectTeamYlInfoList(tyInfo);
        if (CollectionUtils.isEmpty(tyInfoList)) {
            throw new BusinessException("团长信息异常,请检查团长状态");
        }
        //查看当前展业端管理盟主是否是团员
        TeamYlInfoDo ty = new TeamYlInfoDo();
        //团员服务商编号
        ty.setAgentNum(teamYl.getLeaderAgentNum());
        List<TeamYlInfoDo> teamYlInfosDoList = teamYlInfoMapper.selectTeamYlInfoList(ty);
        if (CollectionUtils.isNotEmpty(teamYlInfosDoList)) {
            TeamYlInfoDo teamYlInfo1 = teamYlInfosDoList.get(0);
            if (teamYlInfo1.getYlType().equals("1")) {
                throw new BusinessException("当前团员展业端管理已是团长不可以成为团员");
            }
            if (teamYlInfo1.getYlType().equals("2")) {
                throw new BusinessException("当前团员展业端管理已是团成员,不可重复添加团员");
            }
        }

        //团长信息
        AgentInfo agentInfo = new AgentInfo();
        agentInfo.setAgentNum(teamYlInfo.getAgentNum());
        agentInfo.setEndDate(DateUtils.getDate());
        agentInfo.setSupportLevel("V9");
        List<AgentInfo> teamGroupList = agentInfoMapper.selectAgentInfoList(agentInfo);
        if (CollectionUtils.isEmpty(teamGroupList)){
            throw new BusinessException("当前团长信息不存在,或者已过期,请检查团长展业端管理档位");
        } else {
            agentInfo = teamGroupList.get(0);
        }
        //团员信息
        AgentInfo addGroup = new AgentInfo();
        addGroup.setAgentNum(teamYl.getLeaderAgentNum());
        addGroup = agentInfoMapper.selectAgentInfoList(addGroup).get(0);

        //验证当前团员和团长的关系(是否是上下级 和 平级)
        //如果是平级 扶持等级 都是V9 并且不是过期的
        String isLevel = "";
        if (agentInfo.getSupportLevel().equals(addGroup.getSupportLevel()) && DateUtils.compareDate(DateUtils.YYYY_MM_DD,DateUtils.getDate(),addGroup.getSupportDate()) && addGroup.getBelongAgent().toString().equals("100000000")) {
            //平级
            isLevel = "1";
        } else {
            AgentInfo agent = new AgentInfo();
            agent.setBelongAgent(Long.parseLong(agentInfo.getAgentNum()));
            agent.setAgentNum(teamYl.getLeaderAgentNum());
            List<AgentInfo> agentInfos = agentInfoMapper.selectBetweenAgentNoBelongAgent(agent);
            //不存在上下级关系
            if (CollectionUtils.isEmpty(agentInfos)) {
                isLevel = "1";
            } else {
                isLevel = "0";
            }
        }
        Integer ylIdInfo = teamYlInfoMapper.selectYlId();

        //新增团长信息
        teamYlInfo = new TeamYlInfo();
        teamYlInfo.setYlId(ylIdInfo);
        teamYlInfo.setAgentNum(teamYl.getLeaderAgentNum());
        teamYlInfo.setAgentName(teamYl.getLeaderAgentName());
        teamYlInfo.setStatus("1");
        teamYlInfo.setCreteDate(DateUtils.getDate());
        teamYlInfo.setAddMan(loginName);
        teamYlInfo.setYlType("2");
        teamYlInfo.setTeamYlId(teamYl.getTeamYlId());
        teamYlInfo.setIsLevel(isLevel);
        teamYlInfo.setYlName(addGroup.getCommissary()); //法人名称
        teamYlInfo.setParentYlId(tyInfoList.get(0).getYlId());
        teamYlInfo.setParentYlName(tyInfoList.get(0).getYlName());
        teamYlInfo.setTeamType(tyInfoList.get(0).getTeamType());
        int k = teamYlInfoMapper.insertTeamYlInfo(teamYlInfo);
        if (k  <= 0) {
            throw new BusinessException("新增团员失败");
        }


        TeamYlInfoDo hy = new TeamYlInfoDo();
        hy.setTeamYlId(teamYl.getTeamYlId());
        List<TeamYlInfoDo> all = teamYlInfoMapper.selectTeamYlInfoList(hy);

        //获取当前团队的活跃人数
        hy.setStart("1");
        List<TeamYlInfoDo> teamYlInfoDos = teamYlInfoMapper.selectTeamYlInfoList(hy);


        //获取一个团队信息
        TeamYl tY = teamYlMapper.selectTeamYlById(teamYl.getTeamYlId());
        if (tY.getStatus().equals("0")) {
            throw  new BusinessException("当前团队已关停");
        }
        //更新团队信息(团队人数 和 团队活跃人数)
        TeamYl updateTy = new TeamYl();
        updateTy.setTeamNum(all.size());
        updateTy.setTeamNumHy(teamYlInfoDos.size());
        updateTy.setTeamYlId(teamYl.getTeamYlId());
        int i = teamYlMapper.updateTeamYl(updateTy);
        return i;
    }

    /**
     * 修改团员信息
     * 
     * @param teamYlInfo 团员信息
     * @return 结果
     */
    @Override
    @Transactional
    public int updateTeamYlInfo(TeamYlInfo teamYlInfo,TeamYl teamYl){
        //团长更新政策
        if ("1".equals(teamYlInfo.getYlType())) {
            teamYl.setTeamYlId(teamYlInfo.getTeamYlId());
            //引流
           /* if (StringUtils.isNotEmpty(teamYl.getPolicyYlId().replaceAll(",", ""))) {
                TeamPolicy yl = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(teamYl.getPolicyYlId().replaceAll(",", "")));
                if(yl != null && yl.getPolicyId() != null){
                    teamYl.setPolicyYlId(yl.getPolicyId());
                }
            }else{//所有
                teamYl.setPolicyYlId("300000023");
            }*/
            //采购
            /*if (StringUtils.isNotEmpty(teamYl.getPolicyCgId().replaceAll(",", ""))) {
                TeamPolicy cg = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(teamYl.getPolicyCgId().replaceAll(",", "")));
                if(cg != null && cg.getPolicyId() != null) {
                    teamYl.setPolicyCgId(cg.getPolicyId());
                }
            }else{//所有
                teamYl.setPolicyCgId("300000017");
            }*/
            //增量
            /*if (StringUtils.isNotEmpty(teamYl.getPolicyZlId().replaceAll(",", ""))) {
                TeamPolicy cg = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(teamYl.getPolicyZlId().replaceAll(",", "")));
                if(cg != null && cg.getPolicyId() != null) {
                    teamYl.setPolicyZlId(cg.getPolicyId());
                }
            }else{//所有
                teamYl.setPolicyZlId("300000018");
            }*/
            //GB
            /*if (StringUtils.isNotEmpty(teamYl.getPolicyGbId().replaceAll(",", ""))) {
                TeamPolicy cg = teamPolicyMapper.selectTeamPolicyById(Integer.parseInt(teamYl.getPolicyGbId().replaceAll(",", "")));
                if(cg != null && cg.getPolicyId() != null) {
                    teamYl.setPolicyGbId(cg.getPolicyId());
                }
            }else{//所有
                teamYl.setPolicyGbId("300000023");
            }*/
            int i = teamYlMapper.updateTeamYl(teamYl);
            if (i <= 0) {
                throw new BusinessException("更新政策失败");
            }
        } else {
            //团员信息
            TeamYlInfoDo teamYlInfoDo = teamYlInfoMapper.selectTeamYlInfoById(teamYlInfo.getYlId().toString());
            //团队信息
            TeamYl teamYl1 = teamYlMapper.selectTeamYlById(teamYlInfo.getTeamYlId());
            //查看当前团员状态
            //如果是禁用状态 0  选择的是启用 1 那么活跃人数 +1
            TeamYl uTy = new TeamYl();
            uTy.setTeamYlId(teamYlInfo.getTeamYlId());
            uTy.setTeamNum(teamYl1.getTeamNumHy());
            if (teamYlInfoDo.getStatus().equals("0")  && teamYlInfo.getStatus().equals("1")) {
                uTy.setTeamNumHy(teamYl1.getTeamNumHy() + 1);
            }
            //如果是正常状态 1  选择的是禁用 0 那么活跃人数 -1
            if (teamYlInfoDo.getStatus().equals("1")  && teamYlInfo.getStatus().equals("0")) {
                uTy.setTeamNumHy(teamYl1.getTeamNumHy() - 1);
            }
            teamYlMapper.updateTeamYl(uTy);
        }
        return teamYlInfoMapper.updateTeamYlInfo(teamYlInfo);
    }

    @Transactional
    @Override
    public int updateTeamInfo(TeamYlInfo teamYlInfo) {
        return  teamYlInfoMapper.updateTeamYlInfo(teamYlInfo);
    }


    /**
     * 删除团员信息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTeamYlInfoByIds(String ids)
    {
        return teamYlInfoMapper.deleteTeamYlInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除团员信息信息
     * 
     * @param ylId 团员信息ID
     * @return 结果
     */
    @Override
    public int deleteTeamYlInfoById(String ylId)
    {
        return teamYlInfoMapper.deleteTeamYlInfoById(ylId);
    }


    /**
     * 获取一个团队编号
     * @Param []
     * @Return int
     */
    public String selectTeamCode(){
        return teamYlInfoMapper.selectTeamCode();
    }

    /**
     * 获取团长信息
     * @param agentNum
     * @return
     */
    public Map selectTeamInfoByAgentNum(String agentNum){
        return teamYlInfoMapper.selectTeamInfoByAgentNum(agentNum);
    }


    public static void main(String[] args) {

        String str = ",25";
        System.out.println(str.replace(",",""));


    }

}
